package org.minuframework.file.delete;

import org.minuframework.core.ApplicationConfigurer;
import org.minuframework.exception.ExceptionFailed;
import org.minuframework.file.upload.FileParamerConfigurer;
import org.minuframework.file.upload.FileTypesConfigurer;
import org.minuframework.file.upload.FileUploadType;

@Deprecated
public class FileDelete extends DefaultFileDelete{
    
    public FileDelete(FileParamerConfigurer fileParamerConfigurer, FileTypesConfigurer fileTypesConfigurer, String charset){
        super(fileParamerConfigurer, fileTypesConfigurer, charset);
    }
    
    // ------------------------------------------------------------------------
    
    public static boolean delete(String fileName, FileUploadType type) throws ExceptionFailed{
        return new FileDeleteBuilder().setCharset(ApplicationConfigurer.DEFAULE_MINU_CHARSET).create().deleteFile(fileName, type);
    }
    
    public static boolean deleteSafe(String fileName, FileUploadType type){
        try {
            return delete(fileName, type);
        } catch (ExceptionFailed e) {}
        
        return false;
    }
    
    // ------------------------------------------------------------------------
    
    public static boolean delete(String[] fileNames, FileUploadType type) throws ExceptionFailed{
        return new FileDeleteBuilder().setCharset(ApplicationConfigurer.DEFAULE_MINU_CHARSET).create().deleteFile(fileNames, type);
    }
    
    public static boolean deleteSafe(String[] fileNames, FileUploadType type){
        try {
            return delete(fileNames, type);
        } catch (ExceptionFailed e) {}
        
        return false;
    }
    
}
